<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.xea.service.ServiceFactory"%>
<%@page import="com.xea.service.NewsService"%>
<%@page import="com.xea.util.StringUtil"%>
<%@page import="com.uf.util.PageData"%>
<%@page import="com.xea.model.News"%>
<%@include file="../../inner/head.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <link type="text/css" rel="stylesheet" href="${basepath}/res/images/style.css" />
    <script src="${basepath}/res/js/float.js"></script>
</head>
<body>
	<div class="bg">
	<div class="container">
		<%@include file="../top.jsp" %>
		<div id="list">
			<div id="list_l"> 
				<div style="border: #cbc9ca 1px solid;height: 308px;margin-right: 5px;">
					<h2 class="h2title">About</h2>
					<div style="padding-top: 20px;padding-left: 20px;padding-right: 20px;">
						<ul>
							<li style="height: 90px;"><a href="${basepath}/outer/about.jsp" style="color: #444444;font-size: 14px;">├&nbsp;Introduction</a></li>
							<li style="height: 90px;"><a href="${basepath}/outer/others/culture.jsp" style="color: #444444;font-size: 14px;">├&nbsp;Culture</a></li>
							<li style="height: 90px;"><a href="${basepath}/outer/news/index.jsp" style="color: red;font-size: 16px;font-weight: bold;">├&nbsp;News</a></li>
						</ul>
					</div>
				</div>
				<div id="chat" style="border: #cbc9ca 1px solid;height: 248px;margin-top: 20px;margin-right: 5px;">
					<h2 class="h2title">Live Chat</h2>
					<div class="inner">
						<ul>
							<li class="chatmsn"><a href="msnim:chat?contact=sally1981cn@163.com" target="_blank" style="font-size: 12px;color: #353535;">online service</a></li>
							<li class="chatskype"><a href="skype:kelly_suxiaoyun-SKYPE?call" target="_blank" style="font-size: 12px;color: #353535;">Talk with us</a></li>
							<li class="chatalibaba"><a href="http://amos.us.alitalk.alibaba.com/msg.aw?v=2&uid=xmkelly&site=enaliint&s=5" target="_blank" style="font-size: 12px;color: #353535;">XEK on Alibaba.com</a></li>
							<li class="chatemail"><a href="mailTo:kelly@xekfurniture.com" target="_blank" style="font-size: 12px;color: #353535;">kelly@xekfurniture.com</a></li>
						</ul>
					</div>
				</div>
			</div>
			<div id="list_r">
			  <div style="margin:0px 30px 100px 30px;border:1px solid #aeaeae;">
				<div style="line-height:48px;font-size:22px;font-weight: bold;font-family: '黑体';text-align: left;margin-left: 5px;background:url('${basepath}/res/images/news.png') no-repeat;" ><b style="margin-left: 70px">News Center</b></div>
				<div style="line-height:48px;text-align: left;margin-left: 30px;">
				<table width="100%" border="0" cellpadding="0" cellspacing="1">
				<%
					NewsService newsDao = ServiceFactory.getNewsService();
					String pageNo=request.getParameter("p");
					if(StringUtil.isNullOrEmpty(pageNo) || "0".equals(pageNo))
						pageNo="1";
					PageData pagedata =newsDao.searchforout(pageNo); 
					List nlist = pagedata.getData();
					int cP = pagedata.getCurrentPage();
					int tP = pagedata.getTotalPage();
					int pre = cP-1<1?1:cP-1; 
					int next = cP+1>tP?tP:cP+1;
					for(int i=0;i<nlist.size();i++){
						News news = (News)nlist.get(i);
						if(news.getTitle().length() >=80)
							news.setTitle(news.getTitle().substring(0,80)+"...");
				 %>	
						<tr>
							<td width="13" height="24" align="left">
								<img src="${basepath}/res/image/trt_poi.gif" height="4" width="5" complete="complete"> 
							</td>
							<td width="540px">
								<a target="_blank" href="${basepath}/outer/news/detail.jsp?id=<%=news.getId() %>" style="color: #4a4a4a;font-size: 14px;">
									<%=news.getTitle() %>
								</a>
							</td>
							<td>
								(<%=news.getCreateDate() %>)
							</td>
						</tr>
					<%
						}
					
					%>		
				</table>	
				</div>
				<div class="pagination" style="font-weight: normal;">
					   		<table width="100%" border="0" align="right" cellpadding="0" cellspacing="0">
					          <tr>
					          	<td align="right" style="cursor: pointer;font-weight: bold;" >
						       		<%
						      		if(pagedata.getTotalPage() >1){
						      	 	%>
						       		<a href="${basepath}/outer/news/index.jsp?p=1" style="color:#89140e;padding: 3px;"/>&lt;&lt;</a>
						          	<a href="${basepath}/outer/news/index.jsp?p=<%=pre%>" title="Previous" style="color:#89140e;padding: 3px;"/>Previous</a>
						       		<%
											for(int i=0;i<pagedata.getTotalPage();i++){	
														          			
					          		%>
					          		<a id="st<%=i+1%>" href="${basepath}/outer/news/index.jsp?p=<%=i+1 %>" style="color:#89140e;padding: 3px;"><%=i+1 %></a>
					          		<%}%>
						       		<a href="${basepath}/outer/news/index.jsp?p=<%=next%>" title="Next" style="color:#89140e;padding: 3px;">Next</a>
						           	<a href="${basepath}/outer/news/index.jsp?p=<%=pagedata.getTotalPage()%>" style="color:#89140e;padding: 3px;"/>&gt;&gt;</a>
						     	</td>
					       	  	<td width="40">&nbsp;</td>
					       	  	<%} %>
					       	  	<script>
					       	  		if(<%=pagedata.getTotalPage()%>>1){
										$("#st"+<%=pagedata.getCurrentPage()%>).css("font-weight", "bold"); 
										$("#st"+<%=pagedata.getCurrentPage()%>).css("font-size", "16px"); 
									}
					       	  	</script>
					       	  </tr>
					       	  <input id="pageNo" name="pageNo" type="hidden" value="<%=pagedata.getCurrentPage() %>"/>
					  		</table>
					  		&nbsp;
					  <br/>
				</div>
			  </div>
			</div>
		</div>
			<%@include file="../tail.jsp" %>
	</div>
	</div>
	</body>
</html>
